package service;

import Shiti.Shopti;
import dao.ShopDao;

import java.util.ArrayList;

public class Shopservice {
    ShopDao shopDao =new ShopDao();
    public Shopti queryone(Shopti shopti){
        Shopti shopti1 = shopDao.queryone(shopti);
        return  shopti1;
    }
    //查看商品
    public ArrayList<Shopti>query(){
        ArrayList <Shopti> list =new ArrayList<Shopti>();
        list = shopDao.query();
        return  list;
    }
    //添加商品
    public boolean jia(Shopti shopti){
        boolean a=shopDao.add(shopti);
        return a;
    }
    //删除商品
    public boolean dele(Shopti shopti){
        boolean a=shopDao.dele(shopti);
        if (a){
            System.out.println("删除成功");
        }else {
            System.out.println("删除失败");
        }
        return  a;
    }
    //更改商品厂家
    public boolean changebus(Shopti shopti,String bus){
        boolean a=shopDao.changebus(shopti,bus);
        if (a){
            System.out.println("bus更改成功");
        }else {
            System.out.println("bus更改失败");
        }
        return a;
    }
    //更改商品name
    public boolean changename(Shopti shopti,String name){
        boolean a=shopDao.changename(shopti,name);
        if (a){
            System.out.println("name更改成功");
        }else {
            System.out.println("name更改失败");
        }
        return a;
    }

}
